
type RequestEvent =
'eat' | 'fly'

export default function (request:any, sender:any, sendResponse:Function) {
  switch (request.eventName as RequestEvent) {
    case "eat":
      setTimeout(() => {
        sendResponse({ success: true })
      }, 800)
      return true
    case "fly":
      sendResponse({ success: true, type: "fly" })
    default:
      sendResponse({ success: false, code: 404})
      break;
  }
}